<template>
  <div>
    <el-table border class="inputcolumn" :data="selectedDataCopy" style="width: 1000px">

      <el-table-column label="图标" align="center" prop="couponIconUrl">
          <template slot-scope="scope">
            <el-image v-if="scope.row.couponIconUrl != null && scope.row.couponIconUrl != '' " slot="reference"
              :src="scope.row.couponIconUrl" class="image-rows" :preview-src-list="[scope.row.couponIconUrl]">
            </el-image>
          </template>
        </el-table-column>
        <el-table-column label="优惠券名称" align="center" prop="couponName" :show-overflow-tooltip="true" min-width="120" >

        </el-table-column>
        <el-table-column label="类型" align="center" prop="couponType"  />
        <el-table-column label="优惠内容" align="center" prop="couponAmount" :show-overflow-tooltip="true" width="150">
          <template slot-scope="scope">
            <span>{{ scope.row.amountStr }}</span>
          </template>
        </el-table-column>

        <el-table-column label="开始时间" align="center" prop="startDate" width="160" sortable>
          <template slot-scope="scope">
            <span>{{
                parseTime(scope.row.startDate, "{y}-{m}-{d} {h}:{i}:{s}")
              }}</span>
          </template>
        </el-table-column>
        <el-table-column label="结束时间" align="center" prop="endDate" width="160" sortable>
          <template slot-scope="scope">
            <span>{{
                parseTime(scope.row.endDate, "{y}-{m}-{d} {h}:{i}:{s}")
              }}</span>
          </template>
        </el-table-column>
        <el-table-column label="有效时长" align="center" prop="expireDays" :show-overflow-tooltip="true" />



      <el-table-column align="center" prop="receiveNumber" label="操作" v-if="canDelete">
        <template slot-scope="scope">
          <el-button size="mini" @click="handleDeleteser(scope.$index, scope.row)">删除</el-button>
        </template>
      </el-table-column>
    </el-table>




  </div>
</template>
<script>
export default {
  props: {
    selectedData: {
      type: Object,
      default: function () {
        return {}
      }
    },
    canDelete: {
      type: Boolean,
      default: true
    }
  },
  data() {
    return {
      selectedDataCopy: [],
      pageSizess: [5, 10, 15, 20, 25, 30, 50],
      pageNum: 1,
      pageSize: 5,

    }
  },
  created() {
      this.getList();
  },
  methods: {
    getList() {
      this.selectedDataCopy = [];
      this.selectedDataCopy.push(this.selectedData);
    },
    handleDeleteser(val, row) {
      // 模态框删除按钮
      this.$confirm("是否确认删除本条数据?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "info",
      }).then(() => {
        this.selectedDataCopy = [];
        //数据回传
        this.$emit('tabRespon')
      });
    },
  },
};
</script>

</style>
